<template>
  <div>
    <button @click="checkWords">子组件：点击接下句</button>
    {{ str }}
    <ul>
      <li v-for="item in sondata" :key="item.id">
        姓名: {{ item.name }} 年龄：{{ item.age }}
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  props: {
    str: {
      type: String,
      default: ''
    },
    sondata: {
      type: Array,
      default: () => []
    }
  },
  created() {
    console.log(this.sondata)
  },
  methods: {
    checkWords() {
      // 操作父组件的内容
      this.$emit('fatherFn', '一树梨花压海棠')
    }
  }
}
</script>

<style lang="less" scoped></style>
